{% extends 'base.html.twig' %}

{% block body %}
    <h1>Post list</h1>

    <table>
        <thead>
            <tr>
                <th>Id</th>
                <th>Title</th>
                <th>Description</th>
                <th>Content</th>
                <th>Createat</th>
                <th>Updateat</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
        {% for post in posts %}
            <tr>
                <td><a href="{{ path('post_show', { 'id': post.id }) }}">{{ post.id }}</a></td>
                <td>{{ post.title }}</td>
                <td>{{ post.description }}</td>
                <td>{{ post.content }}</td>
                <td>{% if post.createAt %}{{ post.createAt|date('Y-m-d H:i:s') }}{% endif %}</td>
                <td>{% if post.updateAt %}{{ post.updateAt|date('Y-m-d H:i:s') }}{% endif %}</td>
                <td>
                    <ul>
                        <li>
                            <a href="{{ path('post_show', { 'id': post.id }) }}">show</a>
                        </li>
                        <li>
                            <a href="{{ path('post_edit', { 'id': post.id }) }}">edit</a>
                        </li>
                    </ul>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <ul>
        <li>
            <a href="{{ path('post_new') }}">Create a new entry</a>
        </li>
    </ul>
{% endblock %}
